<!--Javascript-->
<script type="text/javascript" src="<?php echo base_url().'assets/js/jquery.min.js';?>"></script>
<script type="text/javascript" src="<?php echo base_url().'assets/js/bootstrap.min.js';?>"></script>
<script type="text/javascript" src="<?php echo base_url().'assets/js/bootstrap-datepicker.js';?>"></script>

<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>

<!-- Add fancyBox -->
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/lib/fancybox/source/jquery.fancybox.css?v=2.1.4" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.4"></script>

<!-- Optionally add helpers - button, thumbnail and/or media -->
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.5"></script>

<!-- chosen -->
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/chosen/chosen.jquery.min.js"></script>

<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>

<!---------------Scroll To------------>
<script type="text/javascript" src="<?php echo $js_dir; ?>jquery.scrollto.min.js"></script>
<!---------scroll spy---------------------->
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/bootstrap.scrollspy.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/bootstrap-modal/js/bootstrap-modalmanager.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/bootstrap-modal/js/bootstrap-modal.js"></script>


<script type="text/javascript">	
	var loader = "<img src='<?php echo base_url() ?>assets/img/ajax-loader.gif' >";
	var base_url = "<?php echo base_url() ?>";
		
	
	$(document).ready(function(){								
        
        <?php
            if($modal_trigger!=null):
        ?>
            var url = '<?php echo base64_decode(urldecode($modal_trigger)); ?>';	
			loadContentInfo(url);
        <?php
            endif;
        ?>
		
		$('.item').hover(function(){$(this).find('.carousel-caption').fadeIn('fast');},
            function(){
				$(this).find('.carousel-caption').fadeOut('fast');
        });
		
        $('.gallery-item').hover(function(){
			$(this).find('h3.gallery-img-caption').slideDown();
		},
		function()
		{
			$(this).find('.gallery-img-caption').slideUp();
		}
		);
		
		$(".fancybox").fancybox();
		$('#ss-bar').scrollSpy();
		
		
		scrollToContainer($('#home-trigger'));
		$('.scroll-to').click(function(e){			
			e.preventDefault();
			var object = $(this);			
			scrollToContainer(object);
		});
		$("#trigger").hover(function(){ $("#sub-navigation").slideDown('fast'); },function(){$("#sub-navigation").hide();});
		// tab //
		$('#myTab a').click(function (e) {
				e.preventDefault();
				$(this).tab('show');
		})
		
		
		$('a[data-toggle="tab"]').on('shown', function (e) {
		e.target // activated tab
		e.relatedTarget // previous tab
		})
		//tab//
	
		$('.select-atype').on('click',function(e){
			e.preventDefault();
			var id = $(this).attr('href');			
			var sub = $(this).attr('rel');			
			$('.tab-item').hide();
			$('.select-atype').parent().removeClass('active');
			$('li.sub-menu').hide();	
			$(this).parent().addClass('active');
			$(id).fadeIn('fast');
			$(sub).fadeIn('fast');
			
		});
		
		$('.select-gitem').on('click',function(e){
			e.preventDefault();
			var id = $(this).attr('href');			
			$('.gtab-item').hide();
			$(id).fadeIn('fast');
		});				
		$('a.modal-trigger').on('click', function(e) {
			e.preventDefault();
			var url = $(this).attr('href');	
			loadContentInfo(url);			
		});
		
		$('.switch-button').on('click',function(e){
			e.preventDefault();
			var button = $(this);
			var bparent = $(this).parent();
			button.hide();			
			var meta = $(this).attr('rel').split("-");
			var direction = meta[0];		
			var current = $('#'+meta[1]+'-current').val();
			var type = meta[1];	
			$('#'+meta[1]+'-pager').html(loader);			
						
			var data = {'current':current,'direction':direction,'cid':$('#community').val(),'type':type};			
						
			
			$.ajax({
			'url': '<?php echo base_url()."yoradio/get_ajax_feed";?>',
			'type': 'post',
			'dataType':'json',
			'data':data,
			'success': function (data) {				
				button.show();				
				if(data.returned != 0){				
					var to = data.current+data.returned-1;					
					$('#'+meta[1]+'-current').val(data.current);
					$('#'+meta[1]+'-pager').html(data.current+' to '+to+' of '+data.count);
					$('#'+meta[1]+'-tab').html(data.html_view);
					$("#articles").ScrollTo({offset:{top:50}});
				}								
			}
			});
		});
		
		$("#featuredCarousel").hover(function(){
			$(".carousel-control").fadeIn('fast');
		},
		function(){
			$(".carousel-control").fadeOut('fast');
		});
	});
	
	function loadContentInfo(url)
	{		
		$('.modal1').html('<a href="#" class="close-modal" data-dismiss="modal" aria-hidden="true">Close &times;</a><iframe src="'+url+'" frameborder=0 style="width:100%;min-height:800px;overflow-x:hidden;" >');
		$('.modal1').modal('show');				
	}
	
	function scrollToContainer(object)
	{			
			//object.parent().parent().children('li').removeClass('active');			
			var go = object.attr('href');
			
			if(go == "#home")
			{			
				scrollToTop();				
			}
			else
			{
				$(go).ScrollTo({offset:{top:50}});
			}
						
			//object.parent().addClass("active");
		
	}
	
	function scrollToTop()
	{
		$('body,html').animate({
		scrollTop: 0
		}, 800);
	}     
	</script>
<!-------google analytics---------------------->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-18317479-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</body>
</html>